﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.VendorModelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.VendorModelCommandHandler
{
	public class GetVendorModelCommandHandler : IRequestHandler<GetVendorModelCommand, Results<PageOutput<Vendormodel>>>
	{
		private readonly IVendorModelService _vendorModelService;
		/// <summary>
		/// 构造方法
		/// </summary>
		/// <param name="vendorModelService"></param>
		public GetVendorModelCommandHandler(IVendorModelService vendorModelService)
		{
			_vendorModelService = vendorModelService;
		}
		/// <summary>
		/// 供应商管理列表
		/// </summary>
		/// <param name="request"></param>
		/// <param name="cancellationToken"></param>
		/// <returns></returns>
		/// <exception cref="NotImplementedException"></exception>
		public async Task<Results<PageOutput<Vendormodel>>> Handle(GetVendorModelCommand request, CancellationToken cancellationToken)
		{
			var list =await _vendorModelService.GetVendormodel(request.Input);
			return Results<PageOutput<Vendormodel>>.DataResult(list);
		}
	}
}
